package com.anjubao.parking.municipal.user.constants;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 余额充值/消费
 *
 * @author zhuchunfeng
 * @date 2019/6/28 10:09
 */
@Getter
@AllArgsConstructor
public enum BalanceTypeEnum {
    RECHARGE(1, "充值"),
    CONSUME(2, "消费");

    private Integer code;

    private String desc;

    public static String getDescByCode(Integer code) {
        for (BalanceTypeEnum e : BalanceTypeEnum.values()) {
            if (e.getCode().equals(code)) {
                return e.getDesc();
            }
        }
        return null;
    }

    public static Boolean exist(Integer code) {
        for (BalanceTypeEnum e : BalanceTypeEnum.values()) {
            if (e.getCode().equals(code)) {
                return true;
            }
        }
        return false;
    }
}
